package com.jzr.bedside.ui.adapter

import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.blankj.utilcode.utils.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.jzr.bedside.R
import com.jzr.bedside.bean.FeeDataBean


class FeeApadter(data: MutableList<FeeDataBean>?) :
    BaseQuickAdapter<FeeDataBean, BaseViewHolder>(
        R.layout.item_fee,
        data
    ) {

    private var feeChildrenApadter: FeeChildrenApadter? = null

    override fun convert(helper: BaseViewHolder?, item:FeeDataBean?) {

        helper?.setText(
            R.id.tv_date,
            TimeUtils.millis2String(item?.time?.toLong()!!, "yyyy-MM-dd")
        )
        helper?.setText(R.id.tv_totalCostOfDay, item?.totalMoney)
        feeChildrenApadter = FeeChildrenApadter(item?.dataBeanList)

        val childrenRv: RecyclerView? = helper?.getView(R.id.rv_data)
        val manage = LinearLayoutManager(mContext)
        manage.orientation = LinearLayoutManager.VERTICAL
        childrenRv?.layoutManager = manage
        childrenRv?.adapter = feeChildrenApadter

    }


}